import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';

export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [AntDesignVueResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, "./src")
    }
  },
  server: {
    port:3001,    //设置服务启动端口
		open:true,    //设置服务启动时是否自动打开浏览器
		cors:true,    //允许跨域
		//设置代理
		proxy:{
			'/api':{
				target:'http://localhost:3000',
				changeOrigin:true,
				secure:false,
				rewrite:(path) => path.replace('/api/','/')
			}
		}
	},
})
